﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sort
{
    /// <summary>
    /// 简单选择排序
    /// 每次选取剩下数据中最小的数
    /// </summary>
    class SelectSort
    {
        public static void Sort(int[] arr, int k, int n)
        {
            for(int i=0; i<arr.Length; i++)
            {
                int min_idx = i;
                for(int j = i+1; j<arr.Length; j++)
                {
                    if (arr[j] < arr[min_idx])
                    {
                        min_idx = j;
                    }
                }
                lib.Swap<int>(arr, min_idx, i);
            }
        }
    }
}
